package top.yxqz.number3.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.yxqz.number3.entity.Emp;
import top.yxqz.number3.mapper.EmpMapper;
import top.yxqz.number3.service.EmpService;

/**
 * @author: 余小小
 * @description：
 */
@RestController
public class EmpController {
    @Autowired
    private EmpService service;

    /**
     * 通过id查询员工信息
     * 对一对应—对象
     * 对多对应-集合
     */
    @GetMapping("/emp")
    public Emp getEmpById(@RequestParam("id") Integer id) {
        return service.getEmpById(id);
    }

    public void addEmp(Emp emp) {
        service.emp(emp);
    }


}
